<template>
  <div class="main-container"> Loading... </div>
</template>

<script lang="ts" setup>
  import useUserStore from '@/store/modules/user'
  import { onMounted, ref } from 'vue'
  import { useRouter } from 'vue-router'
  const router = useRouter()
  onMounted(async () => {
    let user = JSON.parse(decodeURIComponent(window.location.href.split('?')[1]))
    let resp = await useUserStore().initUser(user.token, user)
    // 设置erp跳转过来的标识
    if (user.url) useUserStore().setJumpFlag(user.jump)
    //重定向到目标页面
    let targetPage = user.url || '/index/home'
    router.push({ path: targetPage })
  })
</script>

<style lang="less" scoped>
  .main-container {
    text-align: center;
    margin-top: 30px;
  }
</style>
